//
//  main.swift
//  ZIFUCHUAN
//
//  Created by huanglei on 2017/9/25.
//  Copyright © 2017年 huanglei. All rights reserved.
//

import Foundation

print("黄磊")
import Foundation
public extension NSString {
    func split(splitStr:NSString)->[NSString] {
        let scanner = Scanner(string: self as String)
        var arr:[NSString] = []
        while (scanner.isAtEnd == false){
            var subStr:NSString? = ""
            scanner.scanUpTo(splitStr as String, into: &subStr)
            arr.append(subStr!)
        }
        return arr
    }
}
let str: NSString = "dong ruan huang lei"
print(str.split(splitStr: " "))
print(str.split(splitStr: " dong "))
print(str.split(splitStr: " ruan "))
print(str.split(splitStr: " huang "))
print(str.split(splitStr: " lei "))

